<template>
  <div v-if="currUser!=null" class="myUser">
    <el-avatar style="margin-top: 10px" :size="40" :src="circleUrl"></el-avatar>
    <el-dropdown class="leftButton">
      <span class="el-dropdown-link">
        下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
      </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>后台管理中心</el-dropdown-item>
              <el-dropdown-item>退出</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
  <div v-else class="myUser">
    <el-link type="primary" :underline="false"
             style="font-size: 20px" @click="goLogin()">
      登录
    </el-link>
  </div>
</template>

<script>
export default {
  name: "headerUser",
  props: {
    currUser: {
      type: Object,
      default(){
        return null
      }
    }
  },
  data () {
    return {
      circleUrl: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
    }
  },
  methods:{
    goLogin(){
      this.$router.push('/login');
    }
  },
}
</script>

<style scoped>
.myUser{
  display: flex;
  margin-left: auto;
  order: 3;
  width: 12%;
  height: 50px;
}
.leftButton{
  margin-left: 20px;
  margin-top: 18px;
}
.el-dropdown-link {
  cursor: pointer;
  color: #409EFF;
}
.el-icon-arrow-down {
  font-size: 11px;
}
</style>